package com.hanbang.maige.mode.enumeration;

import com.hanbang.maige.mode.javabean.quanzi.QuanZiQuanXianData;

import java.util.ArrayList;

/**
 * 作者　　: 李坤
 * 创建时间:2016/9/2　11:01
 * 邮箱　　：496546144@qq.com
 * <p>
 * 功能介绍：Showauthority:查看权限
 * 1:公开(所有人可见),
 * 2:秘密(仅自己可见),
 * 3:好友圈(相互关注好友可见),
 * 4:半公开(好友及好友的好友可见),
 * 5:指定给谁看(选中的好友可见)
 */

public enum ShowQuanXian {

    PUBLIC(1, "公开", "所有人可见"), SHIMI(2, "私密", "仅自己可见"),
    HAOYOUQUAN(3, "好友圈", "相互关注好友可见"), BAN_PUBLIC(4, "半公开", "好友及好友的好友可见"),
    ZHIDING(5, "指定给谁看", "选中的好友可见"), WEIZHI(-100, "未知", "");

    private String valuse;
    private String detail;
    private int key;

    ShowQuanXian(int key, String valuse, String detail) {
        this.valuse = valuse;
        this.detail = detail;
        this.key = key;
    }

    public String getValuse() {
        return valuse;
    }

    public int getKey() {
        return key;
    }

    public static ShowQuanXian getState(int status) {
        if (status == ShowQuanXian.PUBLIC.getKey()) {
            return PUBLIC;
        } else if (status == ShowQuanXian.SHIMI.getKey()) {
            return SHIMI;
        } else if (status == ShowQuanXian.HAOYOUQUAN.getKey()) {
            return HAOYOUQUAN;
        } else if (status == ShowQuanXian.BAN_PUBLIC.getKey()) {
            return BAN_PUBLIC;
        } else if (status == ShowQuanXian.ZHIDING.getKey()) {
            return ZHIDING;
        } else if (status == ShowQuanXian.WEIZHI.getKey()) {
            return WEIZHI;
        }
        return WEIZHI;
    }

    public static ArrayList<QuanZiQuanXianData> getListData() {
        ArrayList<QuanZiQuanXianData> arrayList = new ArrayList<>();
        QuanZiQuanXianData dd = ShowQuanXian.PUBLIC.getData();
        dd.setSelect(true);
        arrayList.add(dd);
        arrayList.add(ShowQuanXian.SHIMI.getData());
        arrayList.add(ShowQuanXian.HAOYOUQUAN.getData());
        arrayList.add(ShowQuanXian.BAN_PUBLIC.getData());
        arrayList.add(ShowQuanXian.ZHIDING.getData());
        return arrayList;
    }

    public QuanZiQuanXianData getData() {
        QuanZiQuanXianData quanZiQuanXianData = new QuanZiQuanXianData();
        quanZiQuanXianData.setKey(key);
        quanZiQuanXianData.setDetaile(detail);
        quanZiQuanXianData.setTitle(valuse);
        return quanZiQuanXianData;
    }

}
